package com.itheima.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("service")
public class ProjectController {
    @Value("${spring.application.name}")
    private String appName;
    @Value("${server.port}")
    private String serverPort;
    @GetMapping(value = "/project/{name}")
    public String findProject(@PathVariable("name") String name)  {
        return "<h2>服务访问成功！</h2>服务名称："+appName+"， 端口号："
                + serverPort +"<br /> 查询的项目：" + name;
    }
    @GetMapping(value = "/user")
    public String findUserByAge(Integer age)  {
        return "<h2>服务访问成功！</h2>服务名称："+appName+"， 端口号："
                + serverPort +"<br /> 用户的年龄：" + age;
    }
}